<?
	 function getDesc($type,$code){
		$retstr="";
		$rsql="select c_code_desc from fixedcode where c_code_type='$type' and c_code='$code' ";
		$rrs=mysql_query($rsql);
		$radata=mysql_fetch_array($rrs);
		$retstr=$radata["c_code_desc"];
		return $retstr;
	  }
	  
	 function get_id($username){
		$id="";
		$sql="select PN_ID from BC_MASTER where C_USERNAME='$username' ";
		$rs=mysql_query($sql);
		$radata=mysql_fetch_array($rs);
		$id=$radata["PN_ID"];
		return $id;
	  }	  
	  
	 function get_left_id($nUplineId){
		$left_id="";
		$sql="select n_left_id from gene where n_id='$nUplineId' ";
		$rs=mysql_query($sql);
		$radata=mysql_fetch_array($rs);
		$id=$radata["n_left_id"];
		return $left_id;
	  }	  
	  
	 function get_right_id($nUplineId){
		$right_id="";
		$sql="select n_right_id from gene where n_id='$nUplineId' ";
		$rs=mysql_query($sql);
		$radata=mysql_fetch_array($rs);
		$id=$radata["n_right_id"];
		return $right_id;
	  }	  
	  
	  

	function checkString($s) {
      	$checkret=false;
		if($s=="") {
			$checkret=true;
		}
		else
		{
			if(strlen($s)==0)
				$checkret=true;
		}
		return $checkret;
      }
	  
	  
	  
      function isContainSpecialCharsforusername($element) {
	  		$checkret=true;	  
	  		if (ereg('[^A-Z0-9]', "$element")) {
				$checkret=true;
			}
			else{
			$checkret=false;
			}
			return $checkret;
		}
		
      function isContainSpecialChars($element) {
	  		$checkret=true;	  
	  		if (ereg('[^A-Z0-9a-z]', "$element")) {
				$checkret=true;
			}
			else{
			$checkret=false;
			}
			return $checkret;
		}		
		
		
      function checkInt($element) {
	  		$checkret=true;	  
	  		if (ereg('[^0-9]', "$element")) {
				$checkret=true;
			}
			else{
			$checkret=false;
			}
			return $checkret;
		}	
		
				
		function isLoginExist($username){
			$islogin=false;
            $sql="select c_password from bc_login where pc_username='$username' ";
            $result=mysql_query($sql);
			$radata=mysql_fetch_array($result);
			$c_password=$radata["c_password"];
			if($c_password !="") {
		    	$islogin=true;
               }
			return $islogin;
	}	

		

	

?>
